<!-- 评分题 -->

<template>
  <div>
    <FormRate v-bind="props" />
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import MyRadio from '../MyRadio'

// ============================== 导出组件 ============================== //

export default CORE.extend(MyRadio, {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MyRate',

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    ...MyRadio.computed,

    /**
     * 属性对象
     */
    props() {
      const { no, max, rule, required } = this.obj
      const dict = Array(max).fill().map((_, i) => [i + 1, this.obj[`tip_${i + 1}`]])

      return {
        bind: `no_${no}`,
        dict,
        max,
        string: true,
        showText: rule !== 'none',
        noLabel: true,
        disabled: this.disabled,
        required: required === 1,
      }
    },
  },
})
</script>
